﻿using System.Linq;
using Sirenix.OdinInspector;
using Sirenix.Utilities;
using UnityEditor;

namespace YooAsset.Editor.AssetBundleOdinEditor
{
    public class AssetBundleGrouperOverview  :GlobalConfig<AssetBundleGrouperOverview>
    {
        [ReadOnly]
        [ListDrawerSettings(Expanded = true)]
        public AssetBundleGrouper[] AllAssetBundleGrouper;
        
        public void UpdateCharacterOverview()
        {
            AllAssetBundleGrouper = AssetDatabase.FindAssets("t:AssetBundleGrouper")
                .Select(guid => AssetDatabase.LoadAssetAtPath<AssetBundleGrouper>(AssetDatabase.GUIDToAssetPath(guid)))
                .ToArray();

            AssetBundleGrouperSettingData.Setting.Groupers = AllAssetBundleGrouper.ToList();
        }
    }
}